﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="OperationResult.cs" company="Elilink">
//   Defor
// </copyright>
// <summary>
//   Class OperationResult
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace BusinessLayer.Results
{
    using BusinessLayer.Enums;

    /// <summary>
    ///     Class OperationResult
    /// </summary>
    public class OperationResult
    {
        #region Constructors and Destructors

        /// <summary>
        ///     Initializes a new instance of the <see cref="OperationResult" /> class.
        ///     Empty constructor for serialization
        /// </summary>
        public OperationResult()
        {
        }

        /// <summary>
        ///     Initializes a new instance of the <see cref="OperationResult" /> class.
        ///     Constructor for error result
        /// </summary>
        /// <param name="errorType">
        ///     Value of <see cref="ErrorType" /> enumeration
        /// </param>
        /// <param name="description">
        ///     String description of the error
        /// </param>
        public OperationResult(ErrorType errorType, string description)
        {
            ErrorType = errorType;
            ErrorDescription = description;
        }

        /// <summary>
        ///     Initializes a new instance of the <see cref="OperationResult" /> class.
        ///     Constructor for success result
        /// </summary>
        /// <param name="result">
        ///     Custom result
        /// </param>
        public OperationResult(object result)
        {
            ErrorType = ErrorType.NoError;
            ErrorDescription = string.Empty;
            Result = result;
        }

        #endregion

        #region Public Properties

        /// <summary>
        ///     Gets or sets the description of the error
        /// </summary>
        public string ErrorDescription { get; set; }

        /// <summary>
        ///     Gets or sets the type of the errors
        /// </summary>
        public ErrorType ErrorType { get; set; }

        /// <summary>
        ///     Gets or sets the custom result
        /// </summary>
        public object Result { get; set; }

        #endregion
    }
}